package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflLawfirm;

@Mapper
public interface MfflLawfirmDao {

    @Select("select * from mffl_lawfirm t where t.id = #{id}")
    MfflLawfirm getById(Long id);

    @Delete("update mffl_lawfirm SET DeleteState = 0 WHERE id = #{id}")
    int delete(Long id);

    int update(MfflLawfirm mfflLawfirm);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")

    @Insert("insert into mffl_lawfirm(name, comid, areaname, address, licensenumber, practisingcertificate, introduce, numberoflawyers, yearsofestablishment, logo, chiefcounsel, registeredcapital, `order`, createTime, updateTime, deleteState, deleteTime, phone, field, province, city, area)" +
            "values(#{name}, #{comid}, #{areaname}, #{address}, #{licensenumber}, #{practisingcertificate}, #{introduce}, #{numberoflawyers}, #{yearsofestablishment}, #{logo}, #{chiefcounsel}, #{registeredcapital}, #{order}, #{createTime}, #{updateTime}, #{deleteState}, #{deleteTime},#{phone}, #{field}, #{province}, #{city}, #{area})")
    int save(MfflLawfirm mfflLawfirm);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflLawfirm> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    List<MfflLawfirm> clientlist(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
